<?php


class userDao {
    
    
    
    
    private $db;

    public function __construct($db) {
        $this->db = $db;
    }
    
    
    Public function getUserByUser($user,$password) {
        
        

        $db = $this->db;
        $stmt = $db->prepare("SELECT * FROM  `users` where user='$user' and password=$password");
        //$stmt->bindParam(1, $user);
        //$stmt->bindParam(2, $password);
        $stmt->execute();
        $row = $stmt->fetch();


        if (isset($row['id'])) {
            $user = new userClass();
            $user->setId($row['id']);
            $user->setName($row['name']);
            $user->setUser($row['user']);
            $user->setPasswurd($row['password']);
            $user->setEmail($row['email']);
            $user->setDateCad($row['datCad']);
            return $user;
        }
        //echo 'não encontrou';
        return false;
    }
    
}

?>
